/**
 ******************************************************************************
 * @file    atu.h
 * @author  hyseim software Team
 * @date    18-Aug-2023
 * @brief   This file provides all the headers of the assi_spi functions.
 ******************************************************************************
 * @attention
 *
 * Copyright (c) 2020 Hyseim. Co., Ltd.
 * All rights reserved.
 *
 * This software is licensed under terms that can be found in the LICENSE file
 * in the root directory of this software component.
 * If no LICENSE file comes with this software, it is provided AS-IS.
 *
 ******************************************************************************
 */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __ATU_H__
#define __ATU_H__

#include "chip_define.h"
#include "common.h"


struct st_atu3 {
	union {
		unsigned char BYTE;
		struct {
			unsigned char TPSC:3;
			unsigned char CKEG:2;
			unsigned char CCLR:3;
		} BIT;
	} TCR;
	unsigned char wk0[1];
	union {
		unsigned char BYTE;
		struct {
			unsigned char MD:4;
			unsigned char BFA:1;
			unsigned char BFB:1;
			unsigned char :2;
		} BIT;
	} TMDR1;
	unsigned char wk1[1];
	union {
		unsigned char BYTE;
		struct {
			unsigned char IOA:4;
			unsigned char IOB:4;
		} BIT;
	} TIORH;
	union {
		unsigned char BYTE;
		struct {
			unsigned char IOC:4;
			unsigned char IOD:4;			
		} BIT;
	} TIORL;
	unsigned char wk2[2];
	union {
		unsigned char BYTE;
		struct {
			unsigned char TGIEA:1;
			unsigned char TGIEB:1;
			unsigned char TGIEC:1;
			unsigned char TGIED:1;
			unsigned char TCIEV:1;
			unsigned char :2;
			unsigned char TTGE:1;
		} BIT;
	} TIER;
	unsigned char wk3[7];
	unsigned short TCNT;
	unsigned char wk4[6];
	unsigned short TGRA;
	unsigned short TGRB;
	unsigned char wk5[8];
	unsigned short TGRC;
	unsigned short TGRD;
	unsigned char wk6[4];
	union {
		unsigned char BYTE;
		struct {
			unsigned char TGFA:1;
			unsigned char TGFB:1;
			unsigned char TGFC:1;
			unsigned char TGFD:1;
			unsigned char TCFV:1;
			unsigned char :2;
			unsigned char TCFD:1;
		} BIT;
	} TSR;
	unsigned char wk7[11];
	union {
		unsigned char BYTE;
		struct {
			unsigned char TTSA:1;
			unsigned char TTSB:1;
			unsigned char :6;	
		} BIT;
	} TBTM;
	unsigned char wk8[57];
	unsigned short TGRE;
};

struct st_atu4 {
	unsigned char wk0[1];
	union {
		unsigned char BYTE;
		struct {
			unsigned char TPSC:3;
			unsigned char CKEG:2;
			unsigned char CCLR:3;			
		} BIT;
	} TCR;
	unsigned char wk1[1];
	union {
		unsigned char BYTE;
		struct {
			unsigned char MD:4;
			unsigned char BFA:1;
			unsigned char BFB:1;
			unsigned char :2;
		} BIT;
	} TMDR1;
	unsigned char wk2[2];
	union {
		unsigned char BYTE;
		struct {
			unsigned char IOA:4;
			unsigned char IOB:4;			
		} BIT;
	} TIORH;
	union {
		unsigned char BYTE;
		struct {
			unsigned char IOC:4;
			unsigned char IOD:4;
		} BIT;
	} TIORL;
	unsigned char wk3[1];
	union {
		unsigned char BYTE;
		struct {
			unsigned char TGIEA:1;
			unsigned char TGIEB:1;
			unsigned char TGIEC:1;
			unsigned char TGIED:1;
			unsigned char TCIEV:1;
			unsigned char :1;
			unsigned char TTGE2:1;
			unsigned char TTGE:1;		
		} BIT;
	} TIER;
	unsigned char wk4[8];
	unsigned short TCNT;
	unsigned char wk5[8];
	unsigned short TGRA;
	unsigned short TGRB;
	unsigned char wk6[8];
	unsigned short TGRC;
	unsigned short TGRD;
	unsigned char wk7[1];
	union {
		unsigned char BYTE;
		struct {
			unsigned char TGFA:1;
			unsigned char TGFB:1;
			unsigned char TGFC:1;
			unsigned char TGFD:1;
			unsigned char TCFV:1;
			unsigned char :2;
			unsigned char TCFD:1;
		} BIT;
	} TSR;
	unsigned char wk8[11];
	union {
		unsigned char BYTE;
		struct {
			unsigned char TTSA:1;
			unsigned char TTSB:1;
			unsigned char :6;	
		} BIT;
	} TBTM;
	unsigned char wk9[6];
	union {
		unsigned short WORD;
		struct {
			unsigned short ITB4VE:1;
			unsigned short ITB3AE:1;
			unsigned short ITA4VE:1;
			unsigned short ITA3AE:1;
			unsigned short DT4BE:1;
			unsigned short UT4BE:1;
			unsigned short DT4AE:1;
			unsigned short UT4AE:1;
			unsigned short :6;
			unsigned short BF:2;			
		} BIT;
	} TADCR;
	unsigned char wk10[2];
	unsigned short TADCORA;
	unsigned short TADCORB;
	unsigned short TADCOBRA;
	unsigned short TADCOBRB;
	unsigned char wk11[40];
	unsigned short TGRE;
	unsigned short TGRF;
};

struct st_atu {
	union {
		unsigned char BYTE;
		struct {
			unsigned char OE3B:1;
			unsigned char OE4A:1;
			unsigned char OE4B:1;
			unsigned char OE3D:1;
			unsigned char OE4C:1;
			unsigned char OE4D:1;
			unsigned char :2;
		} BIT;
	} TOERA;
	unsigned char wk0[2];
	union {
		unsigned char BYTE;
		struct {
			unsigned char UF:1;
			unsigned char VF:1;
			unsigned char WF:1;
			unsigned char FB:1;
			unsigned char P:1;
			unsigned char N:1;
			unsigned char BDC:1;
			unsigned char :1;
		} BIT;
	} TGCRA;
	union {
		unsigned char BYTE;
		struct {
			unsigned char OLSP:1;
			unsigned char OLSN:1;
			unsigned char TOCS:1;
			unsigned char TOCL:1;
			unsigned char :2;
			unsigned char PSYE:1;
			unsigned char :1;
		} BIT;
	} TOCR1A;
	union {
		unsigned char BYTE;
		struct {
			unsigned char OLS1P:1;
			unsigned char OLS1N:1;
			unsigned char OLS2P:1;
			unsigned char OLS2N:1;
			unsigned char OLS3P:1;
			unsigned char OLS3N:1;
			unsigned char BF:2;
		} BIT;
	} TOCR2A;
	unsigned char wk1[4];
	unsigned short TCDRA;
	unsigned short TDDRA;
	unsigned char wk2[8];
	unsigned short TCNTSA;
	unsigned short TCBRA;
	unsigned char wk3[12];
	union {
		unsigned char BYTE;
		struct {
			unsigned char T4VCOR:3;
			unsigned char T4VEN:1;
			unsigned char T3ACOR:3;
			unsigned char T3AEN:1;
		} BIT;
	} TITCR1A;
	union {
		unsigned char BYTE;
		struct {
			unsigned char T4VCNT:3;
			unsigned char :1;
			unsigned char T3ACNT:3;
			unsigned char :1;
		} BIT;
	} TITCNT1A;
	union {
		unsigned char BYTE;
		struct {
			unsigned char BTE:2;
			unsigned char :6;
		} BIT;
	} TBTERA;
	unsigned char wk4[1];
	union {
		unsigned char BYTE;
		struct {
			unsigned char TDER:1;
			unsigned char :7;
		} BIT;
	} TDERA;
	unsigned char wk5[1];
	union {
		unsigned char BYTE;
		struct {
			unsigned char OLS1P:1;
			unsigned char OLS1N:1;
			unsigned char OLS2P:1;
			unsigned char OLS2N:1;
			unsigned char OLS3P:1;
			unsigned char OLS3N:1;
			unsigned char :2;
		} BIT;
	} TOLBRA;
	unsigned char wk6[3];
	union {
		unsigned char BYTE;
		struct {
			unsigned char TITM:1;
			unsigned char :7;
		} BIT;
	} TITMRA;
	union {
		unsigned char BYTE;
		struct {
			unsigned char TRG4COR:3;
			unsigned char :5;
		} BIT;
	} TITCR2A;
	union {
		unsigned char BYTE;
		struct {
			unsigned char TRG4CNT:3;
			unsigned char :5;
		} BIT;
	} TITCNT2A;
	unsigned char wk7[35];
	union {
		unsigned char BYTE;
		struct {
			unsigned char WRE:1;
            unsigned char SCC:1;
			unsigned char :5;
			unsigned char CCE:1;
		} BIT;
	} TWCRA;
	unsigned char wk8[15];
	union {
		unsigned char BYTE;
		struct {
			unsigned char DRS:1;
			unsigned char :7;
		} BIT;
	} TMDR2A;
	unsigned char wk9[15];
	union {
		unsigned char BYTE;
		struct {
			unsigned char CST0:1;
			unsigned char CST1:1;
			unsigned char CST2:1;
			unsigned char :3;
			unsigned char CST3:1;
			unsigned char CST4:1;
		} BIT;
	} TSTRA;
	union {
		unsigned char BYTE;
		struct {
			unsigned char SYNC0:1;
			unsigned char SYNC1:1;
			unsigned char SYNC2:1;
			unsigned char :3;
			unsigned char SYNC3:1;
			unsigned char SYNC4:1;
		} BIT;
	} TSYRA;
	union {
		unsigned char BYTE;
		struct {
			unsigned char SCH7:1;
			unsigned char SCH6:1;
			unsigned char :1;
			unsigned char SCH4:1;
			unsigned char SCH3:1;
			unsigned char SCH2:1;
			unsigned char SCH1:1;
			unsigned char SCH0:1;
		} BIT;
	} TCSYSTR;
	unsigned char wk10[1];
	union {
		unsigned char BYTE;
		struct {
			unsigned char RWE:1;
			unsigned char :7;
		} BIT;
	} TRWERA;
	unsigned char wk11[1925];
	union {
		unsigned char BYTE;
		struct {
			unsigned char OE6B:1;
			unsigned char OE7A:1;
			unsigned char OE7B:1;
			unsigned char OE6D:1;
			unsigned char OE7C:1;
			unsigned char OE7D:1;
			unsigned char :2;
		} BIT;
	} TOERB;
	unsigned char wk12[3];
	union {
		unsigned char BYTE;
		struct {
			unsigned char OLSP:1;
			unsigned char OLSN:1;
			unsigned char TOCS:1;
			unsigned char TOCL:1;
			unsigned char :2;
			unsigned char PSYE:1;
			unsigned char :1;
		} BIT;
	} TOCR1B;
	union {
		unsigned char BYTE;
		struct {
			unsigned char OLS1P:1;
			unsigned char OLS1N:1;
			unsigned char OLS2P:1;
			unsigned char OLS2N:1;
			unsigned char OLS3P:1;
			unsigned char OLS3N:1;
			unsigned char BF:2;
		} BIT;
	} TOCR2B;
	unsigned char wk13[4];
	unsigned short TCDRB;
	unsigned short TDDRB;
	unsigned char wk14[8];
	unsigned short TCNTSB;
	unsigned short TCBRB;
	unsigned char wk15[12];
	union {
		unsigned char BYTE;
		struct {
			unsigned char T7VCOR:3;
			unsigned char T7VEN:1;
			unsigned char T6ACOR:3;
			unsigned char T6AEN:1;
		} BIT;
	} TITCR1B;
	union {
		unsigned char BYTE;
		struct {
			unsigned char T7VCNT:3;
			unsigned char :1;
			unsigned char T6ACNT:3;
			unsigned char :1;
		} BIT;
	} TITCNT1B;
	union {
		unsigned char BYTE;
		struct {
			unsigned char BTE:2;
			unsigned char :6;
		} BIT;
	} TBTERB;
	unsigned char wk16[1];
	union {
		unsigned char BYTE;
		struct {
			unsigned char TDER:1;
			unsigned char :7;
		} BIT;
	} TDERB;
	unsigned char wk17[1];
	union {
		unsigned char BYTE;
		struct {
			unsigned char OLS1P:1;
			unsigned char OLS1N:1;
			unsigned char OLS2P:1;
			unsigned char OLS2N:1;
			unsigned char OLS3P:1;
			unsigned char OLS3N:1;
			unsigned char :2;
		} BIT;
	} TOLBRB;
	unsigned char wk18[3];
	union {
		unsigned char BYTE;
		struct {
			unsigned char TITM:1;
			unsigned char :7;
		} BIT;
	} TITMRB;
	union {
		unsigned char BYTE;
		struct {
			unsigned char TRG7COR:3;
			unsigned char :5;
		} BIT;
	} TITCR2B;
	union {
		unsigned char BYTE;
		struct {
			unsigned char TRG7CNT:3;
			unsigned char :5;
		} BIT;
	} TITCNT2B;
	unsigned char wk19[35];
	union {
		unsigned char BYTE;
		struct {
			unsigned char WRE:1;
            unsigned char SCC:1;
			unsigned char :5;
			unsigned char CCE:1;
		} BIT;
	} TWCRB;
	unsigned char wk20[15];
	union {
		unsigned char BYTE;
		struct {
			unsigned char DRS:1;
			unsigned char :7;
		} BIT;
	} TMDR2B;
	unsigned char wk21[15];
	union {
		unsigned char BYTE;
		struct {
			unsigned char :6;
			unsigned char CST6:1;
			unsigned char CST7:1;
		} BIT;
	} TSTRB;
	union {
		unsigned char BYTE;
		struct {
			unsigned char :6;
			unsigned char SYNC6:1;
			unsigned char SYNC7:1;
		} BIT;
	} TSYRB;
	unsigned char wk22[2];
	union {
		unsigned char BYTE;
		struct {
			unsigned char RWE:1;
			unsigned char :7;
		} BIT;
	} TRWERB;
};

struct st_atu0 {
	union {
		unsigned char BYTE;
		struct {
			unsigned char TPSC:3;
			unsigned char CKEG:2;
			unsigned char CCLR:3;
		} BIT;
	} TCR;
	union {
		unsigned char BYTE;
		struct {
			unsigned char MD:4;
			unsigned char BFA:1;
			unsigned char BFB:1;
			unsigned char BFE:1;
			unsigned char :1;
		} BIT;
	} TMDR1;
	union {
		unsigned char BYTE;
		struct {
			unsigned char IOA:4;
			unsigned char IOB:4;			
		} BIT;
	} TIORH;
	union {
		unsigned char BYTE;
		struct {
			unsigned char IOC:4;
			unsigned char IOD:4;			
		} BIT;
	} TIORL;
	union {
		unsigned char BYTE;
		struct {
			unsigned char TGIEA:1;
			unsigned char TGIEB:1;
			unsigned char TGIEC:1;
			unsigned char TGIED:1;
			unsigned char TCIEV:1;
			unsigned char :2;
			unsigned char TTGE:1;				
		} BIT;
	} TIER;
	union {
		unsigned char BYTE;
		struct {
			unsigned char TGFA:1;
			unsigned char TGFB:1;
			unsigned char TGFC:1;
			unsigned char TGFD:1;
			unsigned char TCFV:1;
			unsigned char :3;	
		} BIT;
	} TSR;
	unsigned short TCNT;
	unsigned short TGRA;
	unsigned short TGRB;
	unsigned short TGRC;
	unsigned short TGRD;
	unsigned char wk0[16];
	unsigned short TGRE;
	unsigned short TGRF;
	union {
		unsigned char BYTE;
		struct {
			unsigned char TGIEE:1;
			unsigned char TGIEF:1;
			unsigned char :5;
			unsigned char TTGE2:1;
		} BIT;
	} TIER2;
	union {
		unsigned char BYTE;
		struct {
			unsigned char TGFE:1;
			unsigned char TGFF:1;
			unsigned char :6;			
		} BIT;
	} TSR2;
	union {
		unsigned char BYTE;
		struct {
			unsigned char TTSA:1;
			unsigned char TTSB:1;
			unsigned char TTSE:1;
			unsigned char :5;
		} BIT;
	} TBTM;
};

struct st_atu1 {
	union {
		unsigned char BYTE;
		struct {
			unsigned char TPSC:3;
			unsigned char CKEG:2;
			unsigned char CCLR:2;
			unsigned char :1;
		} BIT;
	} TCR;
	union {
		unsigned char BYTE;
		struct {
			unsigned char MD:4;
			unsigned char :4;
		} BIT;
	} TMDR1;
	union {
		unsigned char BYTE;
		struct {
			unsigned char IOA:4;
			unsigned char IOB:4;			
		} BIT;
	} TIOR;
	unsigned char wk0[1];
	union {
		unsigned char BYTE;
		struct {
			unsigned char TGIEA:1;
			unsigned char TGIEB:1;
			unsigned char :2;
			unsigned char TCIEV:1;
			unsigned char TCIEU:1;
			unsigned char :1;
			unsigned char TTGE:1;
		} BIT;
	} TIER;
	union {
		unsigned char BYTE;
		struct {
			unsigned char TGFA:1;
			unsigned char TGFB:1;
			unsigned char :2;
			unsigned char TCFV:1;
			unsigned char TCFU:1;
			unsigned char :1;
			unsigned char TCFD:1;
		} BIT;
	} TSR;
	unsigned short TCNT;
	unsigned short TGRA;
	unsigned short TGRB;
	unsigned char wk1[4];
	union {
		unsigned char BYTE;
		struct {
			unsigned char I1AE:1;
			unsigned char I1BE:1;
			unsigned char I2AE:1;
			unsigned char I2BE:1;
			unsigned char :4;
		} BIT;
	} TICCR;
};

struct st_atu2 {
	union {
		unsigned char BYTE;
		struct {
			unsigned char TPSC:3;
			unsigned char CKEG:2;
			unsigned char CCLR:2;
			unsigned char :1;	
		} BIT;
	} TCR;
	union {
		unsigned char BYTE;
		struct {
			unsigned char MD:4;
			unsigned char :4;			
		} BIT;
	} TMDR1;
	union {
		unsigned char BYTE;
		struct {
			unsigned char IOA:4;
			unsigned char IOB:4;			
		} BIT;
	} TIOR;
	unsigned char wk0[1];
	union {
		unsigned char BYTE;
		struct {
			unsigned char TGIEA:1;
			unsigned char TGIEB:1;
			unsigned char :2;
			unsigned char TCIEV:1;
			unsigned char TCIEU:1;
			unsigned char :1;
			unsigned char TTGE:1;
		} BIT;
	} TIER;
	union {
		unsigned char BYTE;
		struct {
			unsigned char TGFA:1;
			unsigned char TGFB:1;
			unsigned char :2;
			unsigned char TCFV:1;
			unsigned char TCFU:1;
			unsigned char :1;
			unsigned char TCFD:1;	
		} BIT;
	} TSR;
	unsigned short TCNT;
	unsigned short TGRA;
	unsigned short TGRB;
};

struct st_atu6 {
	union {
        unsigned char BYTE;
        struct {
			unsigned char TPSC:3;
			unsigned char CKEG:2;
            unsigned char CCLR:3;
        } BIT;
    } TCR;
    unsigned char wk0[1];
    union {
        unsigned char BYTE;
        struct {
			unsigned char MD:4;
			unsigned char BFA:1;
			unsigned char BFB:1;
            unsigned char :2;
        } BIT;
    } TMDR1;
    unsigned char wk1[1];
    union {
        unsigned char BYTE;
        struct {
            unsigned char IOA:4;
			unsigned char IOB:4;
        } BIT;
    } TIORH;
    union {
        unsigned char BYTE;
        struct {
            unsigned char IOC:4;
			unsigned char IOD:4;
        } BIT;
    } TIORL;
    unsigned char wk2[2];
    union {
        unsigned char BYTE;
        struct {
			unsigned char TGIEA:1;
			unsigned char TGIEB:1;
            unsigned char TGIEC:1;
            unsigned char TGIED:1;
            unsigned char TCIEV:1;
            unsigned char :2;
            unsigned char TTGE:1;            
        } BIT;
    } TIER;
    unsigned char wk3[7];
    unsigned short TCNT;
    unsigned char wk4[6];
    unsigned short TGRA;
    unsigned short TGRB;
    unsigned char wk5[8];
    unsigned short TGRC;
    unsigned short TGRD;
    unsigned char wk6[4];
    union {
        unsigned char BYTE;
        struct {
            unsigned char TGFA:1;
            unsigned char TGFB:1;
            unsigned char TGFC:1;
            unsigned char TGFD:1;
            unsigned char TCFV:1;
            unsigned char :2;
            unsigned char TCFD:1;
        } BIT;
    } TSR;
    unsigned char wk7[11];
    union {
        unsigned char BYTE;
        struct {
            unsigned char TTSA:1;
            unsigned char TTSB:1;
            unsigned char :6;
        } BIT;
    } TBTM;
    unsigned char wk8[23];
    union {
        unsigned char BYTE;
        struct {
            unsigned char CE2B:1;
            unsigned char CE2A:1;
            unsigned char CE1B:1;
            unsigned char CE1A:1;
            unsigned char CE0D:1;
            unsigned char CE0C:1;
            unsigned char CE0B:1;
            unsigned char CE0A:1;
        } BIT;
    } TSYCR;
    unsigned char wk9[33];
    unsigned short TGRE;
};

struct st_atu7 {
	unsigned char DUMMY;
    union {
        unsigned char BYTE;
        struct {
            unsigned char TPSC:3;
            unsigned char CKEG:2;
            unsigned char CCLR:3;
        } BIT;
    } TCR;
    unsigned char wk0[1];
    union {
        unsigned char BYTE;
        struct {
            unsigned char MD:4;
            unsigned char BFA:1;
            unsigned char BFB:1;
            unsigned char :2;
        } BIT;
    } TMDR1;
    unsigned char wk1[2];
    union {
        unsigned char BYTE;
        struct {
            unsigned char IOA:4;
            unsigned char IOB:4;
        } BIT;
    } TIORH;
    union {
        unsigned char BYTE;
        struct {
            unsigned char IOC:4;
            unsigned char IOD:4;
        } BIT;
    } TIORL;
    unsigned char wk2[1];
    union {
        unsigned char BYTE;
        struct {
            unsigned char TGIEA:1;
            unsigned char TGIEB:1;
            unsigned char TGIEC:1;
            unsigned char TGIED:1;
            unsigned char TCIEV:1;
            unsigned char :1;
            unsigned char TTGE2:1;
            unsigned char TTGE:1;
        } BIT;
    } TIER;
    unsigned char wk3[8];
    unsigned short TCNT;
    unsigned char wk4[8];
    unsigned short TGRA;
    unsigned short TGRB;
    unsigned char wk5[8];
    unsigned short TGRC;
    unsigned short TGRD;
    unsigned char wk6[1];
    union {
        unsigned char BYTE;
        struct {
            unsigned char TGFA:1;
            unsigned char TGFB:1;
            unsigned char TGFC:1;
            unsigned char TGFD:1;
            unsigned char TCFV:1;
            unsigned char :2;
            unsigned char TCFD:1;
        } BIT;
    } TSR;
    unsigned char wk7[11];
    union {
        unsigned char BYTE;
        struct {
            unsigned char TTSA:1;
            unsigned char TTSB:1;
            unsigned char :6;
        } BIT;
    } TBTM;
    unsigned char wk8[6];
    union {
        unsigned short WORD;
        struct {
            unsigned short ITB7VE:1;
            unsigned short ITB6AE:1;
            unsigned short ITA7VE:1;
            unsigned short ITA6AE:1;
            unsigned short DT7BE:1;
            unsigned short UT7BE:1;
            unsigned short DT7AE:1;
            unsigned short UT7AE:1;
            unsigned short :6;
            unsigned short BF:2;
        } BIT;
    } TADCR;
    unsigned char wk9[2];
    unsigned short TADCORA;
    unsigned short TADCORB;
    unsigned short TADCOBRA;
    unsigned short TADCOBRB;
    unsigned char wk10[40];
    unsigned short TGRE;
    unsigned short TGRF;
};

struct st_atu5 {
	unsigned short TCNTU;
	unsigned short TGRU;
	union {
		unsigned char BYTE;
		struct {
			unsigned char TPSC:2;
			unsigned char :6;
		} BIT;
	} TCRU;
	unsigned char wk0[1];
	union {
		unsigned char BYTE;
		struct {
			unsigned char IOC:5;
			unsigned char :3;	
		} BIT;
	} TIORU;
	unsigned char wk1[9];
	unsigned short TCNTV;
	unsigned short TGRV;
	union {
		unsigned char BYTE;
		struct {
			unsigned char TPSC:2;
			unsigned char :6;			
		} BIT;
	} TCRV;
	unsigned char wk2[1];
	union {
		unsigned char BYTE;
		struct {
			unsigned char IOC:5;
			unsigned char :3;			
		} BIT;
	} TIORV;
	unsigned char wk3[9];
	unsigned short TCNTW;
	unsigned short TGRW;
	union {
		unsigned char BYTE;
		struct {
			unsigned char TPSC:2;
			unsigned char :6;
		} BIT;
	} TCRW;
	unsigned char wk4[1];
	union {
		unsigned char BYTE;
		struct {
			unsigned char IOC:5;
			unsigned char :3;			
		} BIT;
	} TIORW;
	unsigned char wk5[9];
	union {
		unsigned char BYTE;
		struct {
			unsigned char CMFW5:1;
			unsigned char CMFV5:1;
			unsigned char CMFU5:1;
			unsigned char :5;
		} BIT;
	} TSR;
	unsigned char wk6[1];
	union {
		unsigned char BYTE;
		struct {
			unsigned char TGIE5W:1;
			unsigned char TGIE5V:1;
			unsigned char TGIE5U:1;
			unsigned char :5;
		} BIT;
	} TIER;
	unsigned char wk7[1];
	union {
		unsigned char BYTE;
		struct {
			unsigned char CSTW5:1;
			unsigned char CSTV5:1;
			unsigned char CSTU5:1;
			unsigned char :5;
		} BIT;
	} TSTR;
	unsigned char wk8[1];
	union {
		unsigned char BYTE;
		struct {
			unsigned char CMPCLR5W:1;
			unsigned char CMPCLR5V:1;
			unsigned char CMPCLR5U:1;
			unsigned char :5;
		} BIT;
	} TCNTCMPCLR;
};

#define ATUM_BASE   (ATU_BASE + 0x20a)
#define ATU0_BASE   (ATU_BASE + 0x300)
#define ATU1_BASE   (ATU_BASE + 0x380)
#define ATU2_BASE   (ATU_BASE + 0x400)
#define ATU3_BASE   (ATU_BASE + 0x200)
#define ATU4_BASE   (ATU_BASE + 0x200)
#define ATU5_BASE   (ATU_BASE + 0xc80)
#define ATU6_BASE   (ATU_BASE + 0xa00)
#define ATU7_BASE   (ATU_BASE + 0xa00)
#define	ATU	        (*(volatile struct st_atu   *)ATUM_BASE)
#define	ATU0	    (*(volatile struct st_atu0  *)ATU0_BASE)
#define	ATU1	    (*(volatile struct st_atu1  *)ATU1_BASE)
#define	ATU2	    (*(volatile struct st_atu2  *)ATU2_BASE)
#define	ATU3	    (*(volatile struct st_atu3  *)ATU3_BASE)
#define	ATU4	    (*(volatile struct st_atu4  *)ATU4_BASE)
#define	ATU5	    (*(volatile struct st_atu5  *)ATU5_BASE)
#define ATU6	    (*(volatile struct st_atu6  *)ATU6_BASE)
#define	ATU7	    (*(volatile struct st_atu7  *)ATU7_BASE)

#define DIVCLK_1              0x0
#define DIVCLK_4              0x1
#define DIVCLK_16             0x2
#define DIVCLK_64             0x3
#define MTCLKA_EXTE              0x4
#define MTCLKB_EXTE              0x5
#define MTCLKC_EXTE              0X6
#define MTCLKD_EXTE             0X7
#define ATU1_ATU2_CNT       0x7
#define ATU2_DIVCLK_1024      0x7
#define ATU3467_DIVCLK_256    0x4
#define ATU3467_DIVCLK_1024   0x5
#define ATU34_MTCLKA_EXTE        0x6
#define ATU34_MTCLKB_EXTE        0x7

#define RISING_EDGE_CNT         0x0
#define FALLING_EDGE_CNT        0x1
#define BILATERAL_EDGE_CNT      0x2
#define PROHIBIT_CLEARING            0x0
#define TGRA_CLEARING          0x1     
#define TGRB_CLEARING          0x2
#define SYNC_CLEARINGy          0x3
#define TGRC_CLEARING          0x5
#define TGRD_CLEARING          0x6

#define NORMAL_CNT_MODE    0x0
#define PWMMODE_1          0x2
#define PWMMODE_2          0x3
#define PHASEMODE_1        0x4
#define PHASEMODE_2        0x5
#define PHASEMODE_3        0x6
#define PHASEMODE_4        0x7
#define RESET_SYN_PWMMODE  0x8
#define COMPLE_PWMMODE_1   0xd
#define COMPLE_PWMMODE_2   0xe
#define COMPLE_PWMMODE_3   0xf
#define BUFFER_EANBLE      0x1

#define OUTLOW_COMLOW   0x1
#define OUTLOW_COMHIGH  0x2
#define OUTLOW_COMALT   0x3
#define OUTHIGH_COMLOW  0x5
#define OUTHIGH_COMHIGH 0x6
#define OUTHIGH_COMALT  0x7
#define RISING_EDGE_CATCH 0x8
#define FALLING_EDGE_CATCH  0x9
#define BILATERAL_EDGE_CATCH 0xa

#define LOW_LEVEL_INITAL 0
#define HIGH_LEVEL_INITAL 1


typedef struct
{
    uint32_t ATU_mode;
    uint32_t ATU_divClk;
    uint32_t ATU_selectClkEdge;
    uint32_t ATU_cntClearing;
    uint32_t ATU_pinAMode;
    uint32_t ATU_pinBMode;
    uint32_t ATU_pinCMode;
    uint32_t ATU_pinDMode;
    uint32_t deadTime;
    uint32_t cntCycle;
    uint32_t nPhaseInitialLevel;
    uint32_t pPhaseInitialLevel;
    uint32_t bufferA;
    uint32_t bufferB;
}ATU_InitTypeDef;

typedef struct
{
    uint8_t tgiea;
    uint8_t tgieb;
    uint8_t tgiec;
    uint8_t tgied;
    uint8_t tciev;
    uint8_t tcieu;
    uint8_t ttge1;
    uint8_t ttge;
    uint8_t tgiee;
    uint8_t tgief;
    uint8_t ttge2;
    uint8_t tgie5w;
    uint8_t tgie5v;
    uint8_t tgie5u;
}ATU_ITConfigTypedef;

typedef struct
{
    uint8_t ttsa;
    uint8_t ttsb;
    uint8_t ttse;
}ATU_TranModeTypedef;

typedef struct
{
    uint8_t i1ae;
    uint8_t i1be;
    uint8_t i2ae;
    uint8_t i2be;
}ATU_InputConTypedef;

typedef struct
{
    uint8_t sync0;
    uint8_t sync1;
    uint8_t sync2;
    uint8_t sync3;
    uint8_t sync4;
    uint8_t sync6;
    uint8_t sync7;
}ATU_SyncWorkTypedef;

typedef struct
{
    uint16_t compareValueA;
	uint16_t compareValueB;
	uint16_t compareValueC;
	uint16_t compareValueD;
	uint16_t compareValueE;
	uint16_t compareValueF;
}ATU_CompareValueTypedef;




#define ATU0_SEL        0x80
#define ATU1_SEL        0x40
#define ATU2_SEL        0x20  
#define ATU3_SEL        0x10  
#define ATU4_SEL        0x8
#define ATU5_SEL        0x4
#define ATU6_SEL        0x2
#define ATU7_SEL        0x1
#define ATU34_SEL       (ATU3_SEL | ATU4_SEL)
#define ATU67_SEL       (ATU6_SEL | ATU7_SEL)

#define ATU0_TGRA       ATU0.TGRA
#define ATU0_TGRB       ATU0.TGRB
#define ATU0_TGRC       ATU0.TGRC
#define ATU0_TGRD       ATU0.TGRD
#define ATU0_TGRE       ATU0.TGRE
#define ATU0_TGRF       ATU0.TGRF

#define ATU1_TGRA       ATU1.TGRA
#define ATU1_TGRB       ATU1.TGRB

#define ATU2_TGRA       ATU2.TGRA
#define ATU2_TGRB       ATU2.TGRB

#define ATU3_TGRA       ATU3.TGRA
#define ATU3_TGRB       ATU3.TGRB
#define ATU3_TGRC       ATU3.TGRC
#define ATU3_TGRD       ATU3.TGRD
#define ATU3_TGRE       ATU3.TGRE

#define ATU4_TGRA       ATU4.TGRA
#define ATU4_TGRB       ATU4.TGRB
#define ATU4_TGRC       ATU4.TGRC
#define ATU4_TGRD       ATU4.TGRD
#define ATU4_TGRE       ATU4.TGRE
#define ATU4_TGRF       ATU4.TGRF

#define ATU5_TGRU       ATU5.TGRU
#define ATU5_TGRV       ATU5.TGRV
#define ATU5_TGRW       ATU5.TGRW

#define ATU6_TGRA       ATU6.TGRA
#define ATU6_TGRB       ATU6.TGRB
#define ATU6_TGRC       ATU6.TGRC
#define ATU6_TGRD       ATU6.TGRD
#define ATU6_TGRE       ATU6.TGRE

#define ATU7_TGRA       ATU7.TGRA
#define ATU7_TGRB       ATU7.TGRB
#define ATU7_TGRC       ATU7.TGRC
#define ATU7_TGRD       ATU7.TGRD
#define ATU7_TGRE       ATU7.TGRE
#define ATU7_TGRF       ATU7.TGRF


void ATU0_Init(ATU_InitTypeDef* ATU_InitStruct);
void ATU1_Init(ATU_InitTypeDef* ATU_InitStruct);
void ATU2_Init(ATU_InitTypeDef* ATU_InitStruct);
void ATU3_Init(ATU_InitTypeDef* ATU_InitStruct);
void ATU4_Init(ATU_InitTypeDef* ATU_InitStruct);
void ATU6_Init(ATU_InitTypeDef* ATU_InitStruct);
void ATU7_Init(ATU_InitTypeDef* ATU_InitStruct);
void ATU67_JointUseInit(ATU_InitTypeDef* ATU_InitStruct);
void ATU67_StartCnt(void);
void ATU67_StartOutput(void);
void ATU67_StopOutput(void);

void ATU_Init(uint8_t ATU_selsction, ATU_InitTypeDef* ATU_InitStruct);
void ATU_StartCnt(uint8_t startGroup);
void ATU_CompareValueSet(uint8_t ATU_selection, ATU_CompareValueTypedef* ATU_CompareValue);

#endif
